package com.lzw.breezeNovel.webApp.mapper.comic;

import com.lzw.breezeNovel.model.entity.pojo.comic.ComicRating;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.mapper.comic
 * @date 2025/3/17
 * @description
 */
@Mapper
@SuppressWarnings("all")
public interface ComicRatingMapper {



    /**
     * 插入评分
     * @param comicRating
     */
    void insert(ComicRating comicRating);

    /**
     * 查询用户是否已经评分
     * @param userId
     * @param comicId
     * @return
     */
    Boolean selectByUserIdAndComicId(Long userId, Long comicId);

    /**
     * 查询用户评分
     * @param userId
     * @param comicId
     * @return
     */
    @Select("select rating from comic_rating where user_id = #{userId} and comic_id = #{comicId}")
    ComicRating selectRateingByUserIdAndComicId(@Param("userId") Long userId, @Param("comicId") Long comicId);
}
